//
//  HJVisitorTableVC.swift
//  Weibo
//
//  Created by 韩佳 on 16/4/16.
//  Copyright © 2016年 ddg. All rights reserved.
//

import UIKit

class HJVisitorTableVC: UITableViewController,HJVisitorViewDelegate {
    var userLogon: Bool = HJUserAccountViewModel.shareAccount.isLogin
    lazy var visitorView:HJVisitorView = {
       let view = HJVisitorView()
        view.delegate = self
        return view
    }()
    override func loadView() {
        userLogon ? super.loadView() : setupVisitorView()
        
        
    }
    func setupVisitorView(){
        view = visitorView
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "registerBtnClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "loginBtnClick")
    }
    
    
    func registerBtnClick(){
        print("注册按钮被点击")
        
    }
    func loginBtnClick(){
        let OAuth = HJOAuthVc()
        self.presentViewController(UINavigationController(rootViewController: OAuth),animated: true, completion: nil)
    }
}
